package com.lemon.rpcframe.dao.contract;

import java.util.Date;
import java.util.List;

import com.lemon.rpcframe.annotation.OperationContract;
import com.lemon.rpcframe.annotation.ServiceContract;
import com.lemon.rpcframe.dao.Total;
import com.lemon.rpcframe.dao.entity.TaskExecutingBean;

@ServiceContract
public interface ITaskExecutingService {

    /**
     * 保存一条任务运行日志
     * @param entity
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract long insert(TaskExecutingBean entity) throws Exception;

    /**
     * 
     * @param jobid
     * @param taskTrackerNodeGroup
     * @throws Exception
     */
    @OperationContract
    public abstract void deleteByJobID(long jobid) throws Exception;

    /**
     * 
     * @param jobid
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract TaskExecutingBean loadByJobID(long jobid) throws Exception;

    /**
     * 
     * @param taskTrackerIdentity
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract List<TaskExecutingBean> loadByTaskTracker(String taskTrackerIdentity) throws Exception;

    /**
     * 
     * @param createDate
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract List<TaskExecutingBean> loadByCreateDate(Date createDate) throws Exception;

    /**
     * 查询正在执行的任务 按日期倒排
     * @param taskid
     * @param start
     * @param ends
     * @param pageSize
     * @param page
     * @param total
     * @return
     * @order nexttriggerdate desc 
     * @throws Exception
     */
    @OperationContract
    public abstract List<TaskExecutingBean> loadByPage(int pageSize, int page, Total<Integer> total) throws Exception;

    /**
     * 查询正在执行的任务总量
     * @param taskid
     * @param start
     * @param end
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract int countAll() throws Exception;

}
